package com.example.syl.basaimovie.myTask;

import android.os.AsyncTask;
import android.text.TextUtils;
import android.util.Log;
import android.widget.ImageView;

import com.example.syl.basaimovie.httputils.HttpUtils;
import com.example.syl.basaimovie.myinterface.MyInterface;
import com.example.syl.basaimovie.parsejson.ParseUtils;

import java.util.List;

/**
 * Created by syl on 2017/1/6.
 */
public class WelcomeTask extends AsyncTask<String,Void,String>{
    MyInterface.WelcomeBackList backList;

    public WelcomeTask(MyInterface.WelcomeBackList backList) {
        this.backList = backList;
    }

    @Override
    protected String doInBackground(String... params) {
        String json= HttpUtils.getJson(params[0]);
        return json;
    }

    @Override
    protected void onPostExecute(String s) {
        super.onPostExecute(s);
        if (!TextUtils.isEmpty(s)){
            List<String> list= ParseUtils.welcomeParse(s);
            Log.e("####",list.get(0));
            if (list!=null){
                backList.welcomeBackList(list);
            }
        }
    }
}
